<?php
    include 'base.php';

    // 定义字段
    $username = $_POST['username'];
    $password = $_POST['password'];

    $sql = "SELECT * FROM `newuser` WHERE `username`='$username' AND `password`='$password'";

    $res = $conn->query($sql);

    $row = mysqli_fetch_assoc($res);

    if ($row) {
        echo json_encode(Array("err" => 0, "msg" => "登陆成功", "code" => 200));
    } else {
        echo json_encode(Array("err" => 1, "msg" => "账户名或者密码错误", "code" => 200));
    }
?>